<%#
kind: job_template
name: Service Action - SSH Default
model: JobTemplate
job_category: Services
description_format: '%{action} service %{service}'
provider_type: SSH
template_inputs:
- name: action
  description: Action to perform on the service
  input_type: user
  options: "restart\nstart\nstop\nstatus\nreload\nenable\ndisable"
  required: true
- name: service
  description: Name of the service
  input_type: user
  required: true
%>
<% if @host.operatingsystem.family == "Redhat" && @host.operatingsystem.major.to_i > 6 %>
systemctl <%= input("action") %> <%= input("service") %>
<% else %>
  <% case input("action")
  when 'enable' %>
chkconfig --add <%= input("service") %>
  <% when 'disable' %>
chkconfig --del <%= input("service") %>
  <% else %>
service <%= input("service") %> <%= input("action") %>
  <% end %>
<% end -%>
